<?php
/**
* @package   auto_occasion
* @subpackage entreprise
* @author    your name
* @copyright 2011 your name
* @link      http://www.yourwebsite.undefined
* @license    All rights reserved
*/

class entrepriseListeZone extends jZone {
    protected $_tplname='entrepriseListe.zone';

    protected function _prepareTpl(){
        
        jClasses::inc("entreprise~entrepriseSrv");

        $departementId = $this->param('departement', 0);
        $type = $this->param('type', '');
        $fromDepartementChange = $this->param('departementChange', '');
        $region = $this->param('region', '');

        $entreprise        = ($departementId && $region) ? entrepriseSrv::getEntrepriseParRegion($region, $departementId, $type) : array();
       
        $entreprise        = ($fromDepartementChange)? entrepriseSrv::getByDepartement($fromDepartementChange, $type) : $entreprise;
        $entrepriseEnAvant = ($type && $region) ? entrepriseSrv::getByDepartementEnAvant($fromDepartementChange, $type, $region) : array();

        $this->_tpl->assign('entreprise', $entreprise);
        $this->_tpl->assign('entrepriseEnAvant', $entrepriseEnAvant);
    }
}
